package domain;
/*
    JavaBean类的要求
        1.成员变量private修饰
        2.通过get和set方法
        3.必须提供空参构造(满参构造: 没有要求的)
 */
public class Person {
    private String name;
    private int age;

    private int getSum(int a,int b) {
        return a + b;
    }

    public char[] my2CharArray(String str) {
        return str.toCharArray();
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    //空参构造
    public Person() {
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    /*private Person(int age) {
        this.age = age;
    }*/

    public Person(String name) {
        this.name = name;
    }

    public Person (int age){this.age=age;}

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
